package com.carful.xigua.modules.common.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledThreadPoolExecutor;

/**
 * @author Administrator
 * Date 2024/2/29 11:35
 * Description
 */

@Slf4j
@Configuration
public class ThreadPoolConfig {

    @Bean("ThreadPool")
    public ScheduledThreadPoolExecutor NoticeExecutor(){
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2, Executors.defaultThreadFactory(), (r, executor1) -> log.error(executor1 + " - 拒绝任务 - " + r.toString()));
        return executor;
    }
}
